import Vue from 'vue';
//配置路由
import VueRouter from 'vue-router';
Vue.use(VueRouter);
//1、创建组建
import HomePage from "../components/HomePage";
import NewsPage from "../components/NewsPage";
import HomeNews from "../components/news/HomeNews";
import ForeignNews from "../components/news/ForeignNews";
import Life from "../components/Life";
import NewsDetail from "../components/news/detail/NewsDetail";
//2.配置路由
const routes =[
  { path: '/home', component: HomePage },
  { path: '/news', component: NewsPage,
  children:[
    //路由嵌套
    { path: 'homeNews', component: HomeNews },
    { path: 'foreignNews', component: ForeignNews },
  ]
  },
  { path: '/life', component: Life },
  /*动态路由*/
  /*{ path: '/newsDetail/:id', component: NewsDetail},*/
  { path: '/newsDetail', component: NewsDetail},
]
//3.实例化VueRouter  注意：名字
const router = new VueRouter({
  // mode: 'history',   /*hash模式改为history 服务器端需要配置 */
  routes // （缩写）相当于 routes: routes
})

export default router;

